<?php

namespace App\Admin\Middleware;

use Closure;

class LoginMiddleware
{
    /**
     * 登录验证
     */
    public function handle($request, Closure $next)
    {
        if ($request->path() != 'login') {
            if (!auth('admin')->user()) {
                return redirect(route('admin.login', ['referer' => request()->url()], false));
            }
        }
        return $next($request);
    }
}
